package com.weareint.biz.converter;

import com.weareint.biz.entity.TUser;
import com.weareint.biz.vo.TUserVo;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import org.mapstruct.factory.Mappers;


/**
 *
 *
 * <pre>
 *      TUserConverter
 * </pre>
 *
 * @author Johnny
 * @date 2024-04-20
 */
@Mapper
public interface TUserConverter {

   TUserConverter INSTANCE = Mappers.getMapper(TUserConverter.class);


    /**
     * 实体 转 vo
     * @param entity : TUser
     * @return : TUserVo
     */
    @Mappings({
            @Mapping(source = "createTime", target = "createTime", dateFormat = "yyyy-MM-dd HH:mm:ss"),
            @Mapping(source = "updateTime", target = "updateTime", dateFormat = "yyyy-MM-dd HH:mm:ss"),
    })
     TUserVo domain2vo(TUser entity);

    /**
     * vo 转 实体
     * @param vo : TUserVo
     * @return : TUser
     */
    @Mappings({
            @Mapping(source = "createTime", target = "createTime", dateFormat = "yyyy-MM-dd HH:mm:ss"),
            @Mapping(source = "updateTime", target = "updateTime", dateFormat = "yyyy-MM-dd HH:mm:ss"),
    })
    TUser vo2domain(TUserVo vo);
}
